home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 November
/
Chip_2003-11_cd1.bin
/
program
/
delphi
/
kompon
/
BalmsoftPolyglot.exe
/
{app}
/
Demos
/
Delphi 4
/
bsPolyglotDemoFrm.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2003-08-07
|
2KB
|
93 lines
unit bsPolyglotDemoFrm;
interface
uses
Windows, Messages, SysUtils,
{$IFDEF D6_OR_HIGHER}
Variants,
{$ENDIF}
Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, TypInfo, DB, Grids,
DBGrids, bsPolyglotUn, DBTables;
type
TbsPolyglotDemoForm = class(TForm)
cbLanguages: TComboBox;
Label1: TLabel;
Memo1: TMemo;
Label2: TLabel;
Button1: TButton;
Panel1: TPanel;
DataSource1: TDataSource;
ComboBox1: TComboBox;
Label3: TLabel;
RadioGroup1: TRadioGroup;
Button2: TButton;
Panel2: TPanel;
DBGrid1: TDBGrid;
bsPolyglotTranslator1: TbsPolyglotTranslator;
PolyglotManager: TbsPolyglotManager;
Label4: TLabel;
Table1: TTable;
procedure FormCreate(Sender: TObject);
procedure cbLanguagesChange(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
procedure FillLanguages;
public
{ Public declarations }
end;
var
bsPolyglotDemoForm: TbsPolyglotDemoForm;
implementation
{$R *.dfm}
resourcestring
strYouSelected = 'You Selected: ';
strMessage1 = 'Message1';
procedure TbsPolyglotDemoForm.FillLanguages;
var
lPolyglot: TbsCorePolyglot;
i: Integer;
begin
// same dir as exe file
PolyglotManager.LangsDir := ExtractFileDir(ParamStr(0));
cbLanguages.Items.Clear;
lPolyglot := TbsCorePolyglot.GetCorePolyglot;
for i := 0 to lPolyglot.LangCount - 1 do
begin
cbLanguages.Items.Add(lPolyglot.Langs[i]);
if lPolyglot.Langs[i] = lPolyglot.CurrentLang then
cbLanguages.ItemIndex := i;
end;
end;
procedure TbsPolyglotDemoForm.FormCreate(Sender: TObject);
begin
FillLanguages;
end;
procedure TbsPolyglotDemoForm.cbLanguagesChange(Sender: TObject);
begin
PolyglotManager.CurrentLang := cbLanguages.Text;
FillLanguages;
end;
procedure TbsPolyglotDemoForm.Button1Click(Sender: TObject);
begin
MessageDlg(strMessage1, mtInformation, [mbOk], 0);
end;
procedure TbsPolyglotDemoForm.Button2Click(Sender: TObject);
begin
MessageDlg(strYouSelected + RadioGroup1.Items.Strings[RadioGroup1.ItemIndex], mtInformation, [mbOk], 0);
end;
end.